﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LJ.FaultHandler.Abstractions;

public interface IFaultHandler
{
    /// <summary>
    /// 执行
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="callback"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task<T> ExecuteAsync<T>( Func<CancellationToken, Task<T>> callback, CancellationToken cancellationToken = default);

    /// <summary>
    /// 执行
    /// </summary>
    /// <param name="callback"></param>
    /// <param name="cancellationToken"></param>
    /// <returns></returns>
    Task ExecuteAsync(Func<CancellationToken, Task> callback, CancellationToken cancellationToken = default);
}
